Skip to content

Reopen the OPUS decoder when a note moves to another sample - #7137

Merged
serprex merged 3 commits into
HarbourMasters:developfrom
bassdr:fix/streamed-note-stale-opus-decoder
Sep 6, 2026
Merged

Reopen the OPUS decoder when a note moves to another sample#7137
serprex merged 3 commits into
HarbourMasters:developfrom
bassdr:fix/streamed-note-stale-opus-decoder

Conversation

@bassdr

@bassdr bassdr commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #5684.

aOPUSdecImpl caches its OggOpusFile on the note and keys it on nothing, so a note reused for a different streamed sample carries on decoding the track the previous note was playing. Audio_NoteDisable frees the handle, but Audio_NoteInitForLayer can run on a note that still owns one.

This is why the audio editor looks right: sequence and soundfont selection are correct, only the samples reaching the mixer are not. #6736 fixed the selection half of the issue; this is the rest.

Reproduced on the game-start cutscene chain with a streamed music pack (OOT OST Enhanced) in 4 of 6 runs, 0 of 6 after. Detected with a probe on aOPUSdecImpl comparing the source buffer against the one the open handle was created for.

Build Artifacts

Comment thread soh/include/z64audio.h Outdated
The decoder cached on a note was keyed on nothing, so a note reused for a
different streamed sample carried on decoding the previous track. Audible as
the wrong custom music: the sequence and soundfont the audio editor reports
are correct, only the samples reaching the mixer are not.

Reproduced on the game-start cutscene chain with a streamed music pack in 4
of 6 runs; 0 of 6 after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Ex3z29fQzPEZgwH4EA641
@bassdr
bassdr force-pushed the fix/streamed-note-stale-opus-decoder branch from d00423b to fd9f4d3 Compare August 31, 2026 22:47
@serprex

serprex commented Sep 5, 2026

Copy link
Copy Markdown
Member

bassdr/pull/2 is my thoughts on where this bookkeeping belongs

refactor opus decoder fix to handle in decoder rather than note
@serprex
serprex merged commit 17a4c2c into HarbourMasters:develop Sep 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Audio: Incorrect music played during certain events.

2 participants